﻿<!DOCTYPE html >
<!--[if IE 8]> <html lang="zh" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="zh" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro" lang="zh">
<head>
<title>场内支付信息确定</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="full-screen" content="yes">
<meta name="browsermode" content="application">
<meta name="x5-fullscreen" content="true">
<meta name="x5-page-mode" content="app">
	<link th:href="@{/css/lxs_index.css}" rel="stylesheet" type="text/css"/>
	<link th:href="@{/css/lxsHeadFoot.css}" rel="stylesheet" type="text/css"/>
	<link th:href="@{/css/order_new.css}" rel="stylesheet" type="text/css"/>
	<link rel="stylesheet" th:href="@{/css/common.css}"/><!-- 页面基本样式 -->
	<script th:src="@{/js/jquery.min.js}" type="text/javascript"></script>

</head>
<body>

<div class="content">
	<div class="headTop">
		<span>场内支付</span>
	</div>
</div>


<div class="j_main m-main">
	<form action="" method="post" name="form_1">
		
		<div class="tit" style="padding-left:0px !important;">
			<i></i>确认停车信息
		</div>
		<div class="txt">
			<dl>
				<dt>停车场名称</dt>
				<dd class="line30" ><input th:value="${data['parkName']}"></dd>
			</dl>
			<dl>
				<dt>车牌号码</dt>
				<dd class="line30">
					<input type="text" name="plate" id="plate">
				</dd>
			</dl>
		</div>
		<div class="tit" style="padding-left:0px !important;">
			<i></i>提示信息<br>
			<span style="padding-left: 15px;">注：请认真核查车牌号信息</span>
		</div>
		<div class="txt txt2 J_baoxian">
		</div>
		<input type="hidden" name="parkId" id="parkId" th:value="${data['parkId']}">
		<input type="hidden" name="terminalId" id="terminalId" th:value="${data['terminalId']}">
		<script type="text" id="j_baoxian_con"> <dl> <dt> <a href="javascript:;" class="j_baoxian_tit J_baoxian_info">*title*</a> <input type="hidden" name="*name1*" value="*id*" /> <input type="hidden" name="*name2*" value="*price*" /> </dt> <dd> <font><span class="j_baoxian_c">*price_c*</span><i class="more"></i></font> </dd> </dl> </script>

	</form>
	<div class="submintFix">
		<dl>
			<dt>
			<div class="price">
			</div>
			</dt>
			<dd class="sbmFix"><button type="button"  onclick="getOrder()" >确定</button></dd>
		</dl>
	</div>
</div>
<!--<script src="/static/js/min_com.js"></script>-->
<script th:src="@{/plugins/layer/layer.js}"></script>
<script>

	function getOrder() {

		let plate =$("#plate").val();//获取车牌号
        let parkId = $("#parkId").val();
        let terminalId = $("#terminalId").val();
		if(plate !=null && plate !=''){
			$.ajax({
				url: "/fieldPay/getOrder",
				type: "post",
				data: {"plate":plate,"parkId":parkId,"terminalId":terminalId},
				dataType: "json",
				async: true,
				success: function (data) {
					if(data.success){
						getNewsOrder(plate,1);
					}else{
						layer.close(window.layer_load);
						layer.msg("请求超时");
					}

				},
				error: function (XMLHttpRequest, textStatus) {
					layer.close(window.layer_load);
					layer.msg("请求超时");

				},
				beforeSend: function () {
					window.layer_load = layer.load(1, {
						shade: [0.1,'#fff'] //0.1透明度的白色背景
					});
				},
			});

		}else{
			layer.msg('车牌号码不允许为空');
		}
	}

	/*根据车牌号获取最新的支付订单*/
	function getNewsOrder(plate,num){
	    let parkId = $("#parkId").val();
	    let terminalId = $("#terminalId").val();
		$.ajax({
			url: "/fieldPay/getNewsOrder",
			type: "post",
			data: {"plate":plate,"parkId":parkId,"num":num,"terminalId":terminalId},
			dataType: "json",
			async: true,
			success: function (data) {
				if(data.success){
					layer.close(window.layer_load);
					var orderId = data.data;
					window.location.href="/fieldPay/fieldSureOrder?orderId="+orderId;
				}else{

					// if(data.code ==2){
					// 	var n = data.data;//准备第几次获取
					// 	if(n <=3){
					// 		getNewsOrder(plate,n);
					// 	}
					// }
					// layer.close(window.layer_load);
					// layer.msg("请求超时");
				}
				layer.close(window.layer_load);

			},
			error: function (XMLHttpRequest, textStatus) {
				layer.close(window.layer_load);
				layer.msg("请求超时");


			},
			beforeSend: function () {
				window.layer_load = layer.load(1, {
					shade: [0.1,'#fff'] //0.1透明度的白色背景
				});
			},
		});
	}


</script>
</body>
</html>